{% extends "guestbook/template.html" %}
{% block content %}

<form action="/guestbook/search/" method="post">
	{% csrf_token %}
	<table>
		<tr>
			<td>
				{{ search_form.as_p }}				
			</td>
			<td>
				<input type="submit" value="Filter by nick"  class="btn"/>				
			</td>
		</tr>
	</table>
</form>

{% if all_comments %}
    
    {% for com in all_comments %}
		<div class="entry">
			<div>
				Nickname: <a href="{{ com.id }}"> {{ com.nickname }}</a>
			</div>
			<div>
	        	Text: {{ com.textstart }}
			</div>
			<div>				
	        	Publish date: {{ com.pub_date }}
			</div>
		</div>
    {% endfor %}
{% else %}
	<p>No entries in quest book</p>
{% endif %}

<br/>

{% if message %}
	<p class="error">Message: {{ message }}</p>
{% endif %}
<form action="/guestbook/add/" method="post">
	{% csrf_token %}
	{{ form.as_p }}
	<input type="submit" value="Submit" class="btn"/>
</form>
{% endblock %}